import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store' 
import tabbar from '@/components/Tabbar'
import swiper from '@/components/Swiper'
import end from '@/components/Footer'
import 'normalize.css/normalize.css'
import "../public/icons/iconfont.css"
 

Vue.config.productionTip = false

import axios from 'axios'
Vue.prototype.axios = axios
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')


Vue.component('tabbar',tabbar)      //全局注册组件

Vue.component('swiper',swiper)

Vue.component('end',end)
 

//解决路由跳转滚动条仍停留在上个页面滚动条的bug
router.beforeEach((to, from, next) => {
    // chrome
    document.body.scrollTop = 0
        // firefox
    document.documentElement.scrollTop = 0
        // safari
    window.pageYOffset = 0
     /* 路由发生变化修改页面title */
     if (to.meta.title) {
        document.title = to.meta.title
      }
      next()
    next()
}) 